package com.example.demo.entity.dto;

import com.example.demo.verify.NoEmpty;
import com.example.demo.verify.NoEmptyNoWicked;
import com.example.demo.verify.NoMoney;
import com.example.demo.verify.NoWicked;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 1、有分组的情况下，若字段没有标明分组，在已标明分组的接口中，不会被校验
 * 2、有分组的情况下，若字段没有标明分组，它只会在未标明分组的接口中，才校验
 * 3、不同的分组，可设置不同的校验规则
 *
 * 强调：有分组的情况下，DTO类的字段都要标明分组，调用它的接口也要标明分组
 */
@Data
@ApiModel(description = "企业信息传参")
public class CompanyDTO {
    @ApiModelProperty("企业ID")
    @NoEmpty(message = "企业ID格式异常", groups = { Edit.class, Info.class })
    private String companyId;

    @ApiModelProperty("企业名称")
    @NoWicked(message = "企业名称格式异常", groups = { Add.class, Edit.class, Delete.class })
    @NoEmptyNoWicked(message = "关键词格式异常", groups = { Query.class })
    private String name;

    @ApiModelProperty("所在地址")
    @NoWicked(message = "所在地址格式异常", groups = { Add.class, Edit.class, Atomization.class })
    private String address;

    @ApiModelProperty("注册资本")
    @NoMoney(message = "注册资本格式异常", groups = { Add.class, Edit.class })
    private String money;

    @ApiModelProperty("创建人")
    @NoWicked(message = "创建人格式异常", groups = { Add.class, Edit.class, Atomization.class })
    private String creater;

    @ApiModelProperty("创建时间")
    @NoEmpty(message = "创建时间格式异常", groups = { Info.class })
    private String sendtime;


    public interface Add {}
    public interface Edit {}
    public interface Delete {}
    public interface Info {}
    public interface Query {}
    public interface Atomization {}
}
